import {
	baseUrl
} from './config.js'


const listIds = ['3', '0', '2', '1']

export function topList() {
	return new Promise(function(reslove, reject) {

		uni.request({
			url: `${baseUrl}/toplist/detail`,
			method: 'GET',
			data: {},
			success: res => {
				let result = res.data.list;
				result.length = 4;
				listIds.forEach((item, i) => {
					result[i].listId = item
				})
				reslove(result);
			},
			fail: () => {},
			complete: () => {}
		})
	})
}


export function list(id) {
	return uni.request({
		url: `${baseUrl}/playlist/detail?id=${id}`,
		method: 'GET'
	})
}

/**
 *  /song/detail?ids=2690353112   歌曲详情
 */

export function detail(id) {
	return uni.request({
		url: `${baseUrl}/song/detail?ids=${id}`,
		method: 'GET'
	})

}


 //			 /simi/song?id=12345678		  相似歌曲	
 export function simi(id){
	 return uni.request({
	 	url: `${baseUrl}/simi/song?id=${id}`,
		method:'GET',
	 })
 }
 //			 /comment/music?id=2690353112    歌曲评论
 export function comment(id){
 	 return uni.request({
 	 	url: `${baseUrl}/comment/music?id=${id}`,
 		method:'GET',
 	 })
 }
 //			 /lyric?id=12345678            歌词
 export function lyric(id){
 	 return uni.request({
 	 	url: `${baseUrl}/lyric?id=${id}`,
 		method:'GET',
 	 })
 }
 //			 /song/url?id=2690353112         音乐地址
 export function song(id){
 	 return uni.request({
 	 	url: `${baseUrl}/song/url?id=${id}`,
 		method:'GET',
 	 })
 }
 
 
 // /search/hot/detail    热搜榜
 export function searchHot(){
	 return uni.request({
	 	url: `${baseUrl}/search/hot/detail`,
		method: 'GET'
	 })
 }
 
 
 // /search?keywords=少年
 export function searchWord(word){
 	 return uni.request({
 	 	url: `${baseUrl}/search?keywords=${word}`,
 		method: 'GET'
 	 })
 }
 
 
 // /search/suggest?keywords=少年&type=mobile
 export function searchSuggest(word){
 	 return uni.request({
 	 	url: `${baseUrl}/search/suggest?keywords=&{word}type=mobile`,
 		method: 'GET'
 	 })
 }